import request from '@/utils/request'

// 获取师训信息列表(带分页)
export function getTrainList(data) {
  return request({
    url: '/api/campus/train',
    method: 'GET',
    data
  })
}

// 获取师训信息列表
export function getTrainNoPagingList(data) {
  return request({
    url: '/api/campus/train/nopaging',
    method: 'GET',
    data
  })
}

// 添加师训信息
export function createTrain(data) {
  return request({
    url: '/api/campus/train',
    method: 'POST',
    data
  })
}

export function getTrainDduction(data) {
  return request({
    url: `/api/campus/train/${data.trainId}/set/rules/deduction`,
    method: 'POST',
    data
  })
}
// 获取师训信息
export function getDeductionInfo(id) {
  return request({
    url: `/api/campus/train/${id}/deduction`,
    method: 'GET'
  })
}
// 获取师训信息
export function getTrainInfo(id) {
  return request({
    url: `/api/campus/train/${id}`,
    method: 'GET'
  })
}

// 获取师训信息
export function getTrainSelector() {
  return request({
    url: '/api/campus/train/selector',
    method: 'GET'
  })
}

// 修改师训信息
export function updateTrain(data) {
  return request({
    url: `/api/campus/train/${data.id}`,
    method: 'PUT',
    data
  })
}

// 修改状态
export function changeEnabledMark(data) {
  return request({
    url: `/api/campus/train/change/${data.id}/${data.enabledMark}`,
    method: 'PUT'
  })
}

// 删除师训信息
export function delTrain(id) {
  return request({
    url: `/api/campus/train/${id}`,
    method: 'DELETE'
  })
}

//报名
export function sign(data) {
  return request({
    url: `/api/campus/train/sign/${data.trainId}`,
    method: 'PUT',
    data
  })
}

//报名信息审核
export function changeStatus(id, data) {
  return request({
    url: `/api/campus/train/sign/stauts/${id}/${data.status}`,
    method: 'POST'
  })
}

//报名信息审核
export function syncTeacherInfo(id) {
  return request({
    url: `/api/campus/train/sign/sync/teacher/${id}`,
    method: 'POST'
  })
}

//更换师训
export function changeTrain(data) {
  return request({
    url: `/api/campus/train/sign/change/${data.id}`,
    method: 'PUT',
    data
  })
}
export function changeNewTrain(data) {
  return request({
    url: `/api/train/sign/change/${data.id}`,
    method: 'PUT',
    data
  })
}
//更换校区/老师
export function changeTeacher(data) {
  return request({
    url: `/api/campus/train/sign/change/teacher/${data.id}`,
    method: 'PUT',
    data
  })
}

//更换校区/老师
export function changeNewTeacher(data) {
  return request({
    url: `/api/train/sign/change/teacher/${data.id}`,
    method: 'PUT',
    data
  })
}


// 左上区域面板数据
export function getTrainSummary(data) {
  console.log(data, '123')
  return request({
    url: `/api/campus/train/dashboard/panel/one/${data.year}`,
    method: 'POST',
    data
  })
}
// 统计数据
export function getTrainPanelThree(data) {
  return request({
    url: `/api/campus/train/dashboard/panel/three/${data.brand}/${data.year}/${data.month}`,
    method: 'POST',
    data
  })
}
export function getTrainPanelFour(data) {
  return request({
    url: `/api/campus/train/dashboard/panel/four/${data.brand}/${data.year}/${data.month}`,
    method: 'POST',
    data
  })
}
